<?php

/**
 * Admin_Acl File
 * 
 * Short file description
 *
 * PHP Version: 5.3.26
 * 
 * @category Admin_Acl
 * @package  Admin_Acl_Package
 * @author Johari <joharijumali@gmail.com>  
 */

use Admin\Libraries\Acltree;
use Admin\Models\User\Acl;

/**
 * Admin_Acl class
 * 
 * Class description
 *
 * @category Admin_Acl_Controller
 * @package  Admin_Acl_Package
 * @author Johari <joharijumali@gmail.com>   
 */

class Admin_Acl_Controller extends Admin_Base_Controller 
{

	public $restful = true;

     /**
	  * get_setup Method
	  *
	  * View page for setting up ACL   
	  *
	  * @return void
	  */

	public function get_setup()
	{
        $data['tree'] = Acltree::render();

        return View::make('admin::acl.setup', $data);
	}

     /**
	  * post_setup Method
	  *
	  * Setting up system ACL   
	  *
	  * @return void
	  */

	public function post_setup()
	{
        try {
            Acl::regAcl(Input::get());

            return Redirect::to('admin/acl/setup')->with_input();
        } catch (Exception $e) {
            Log::write('acl', 'Error During ACL Registration By <code>'.Auth::user()->username.'</code>');
            Log::write('acl', 'Error: '.$e->getMessage());
        }
	}


}
